from rehtml import render

html = '<html>\n%(head)s\n%(body)s\n</html>'

head = '<head><title>My site: %s </title></head>'

body = '<body bgcolor="#%(color)s">%(content)s</body>'

h1 = '<h1>%s</h1>'

title = "Hello World!"

body %= {'color': 'AAA', 'content': h1%title}

html %= {'head': head%title, 'body': body}

render(html)